﻿using Batman.Jianbei.Forum.Controllers.Posts.Responses;
using Batman.Jianbei.Forum.Core.Domains.Posts;
using Omu.ValueInjecter;

namespace Batman.Jianbei.Forum.Controllers.Posts.Converts
{
    public static class PostConverter
    {
        public static PostResponse ToPostResponse(this Post post)
        {
            PostResponse result = new PostResponse().InjectFrom(post) as PostResponse;

            result.WxUserName = post.WxUser == null ? null : post.WxUser.Nickname;
            result.TopicName = post.Topic == null ? null : post.Topic.Name;

            return result;
        }
    }
}
